<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>九刀流导航管理</title>
    <link rel="stylesheet" th:href="@{/css/bootstrap.min.css}">
    <script type="application/javascript" th:src="@{/js/jquery.min.js}"></script>
</head>
<body>
<!--管理页面
1. 资源地址增(增加新的资源)删改(禁用,修改参数)(目前仅支持链接资源)

-->

<div class="container-fluid">
    <div class="row">
        title
    </div>

</div>
<div class="container-fluid">
    <div class="row">
        <div class="col" id="sources-add">
            <button onclick="showAdd()">新增</button>
        </div>
    </div>

</div>
<div class="container-inner" id="source">
    <hr>
    <div class="row">
        <div class="col">
            <p>新增资源</p>
            <hr>
            <form th:action="@{/}" method="post">
                <span>资源路径</span><input type="text" name="sourcesUrl" id="sourcesUrl"><br>
                <span>资源名称</span><input type="text" name="sourcesName" id="sourcesName"><br>
                <span>资源描述</span><input type="text" name="sourcesDesc" id="sourcesDesc"><br>
                <span>所属模块</span>
                <select name="modelId" id="modelId">
                </select>
                <span>资源类型</span>
                <select name="sourceTypeId" id="sourceTypeId">
                </select>
                <br>
                <input type="button" value="提交" onclick="addNew()">
                <input type="button" value="取消" onclick="hideAdd()">
            </form>
        </div>

        <div class="col">
            <p>新增资源类型</p>
            <hr>
            <form th:action="@{/}" method="post">
                <span>类型名称</span><input type="text" name="typeName" id="typeName"><br>

                <input type="button" value="提交" onclick="addNew()">
                <input type="button" value="取消" onclick="hideAdd()">
            </form>
        </div>
        <div class="col">
            <p>新增模块</p>
            <hr>
            <form th:action="@{/}" method="post">
                <span>模块名称</span><input type="text" name="modelName" id="modelName"><br>
                <span>模块标识</span><input type="text" name="modelImg" id="modelImg"><br>
                <input type="button" value="提交" onclick="addNew()">
                <input type="button" value="取消" onclick="hideAdd()">
            </form>
        </div>

    </div><!--<div class="col">
            <p>新增标签</p>
            <hr>
            <form th:action="@{/}" method="post">
                <span>资源路径</span><input type="text" name="sourcesUrl"><br>
                <span>资源名称</span><input type="text" name="sourcesName"><br>
                <span>资源描述</span><input type="text" name="sourcesDesc"><br>
                <span>所属模块</span>
                <select name="modelId">
                    <option value="">a</option>
                </select>
                <span>资源类型</span>
                <select name="sourceTypeId">
                    <option value="">s</option>
                </select>
                <br>
                <input type="button" value="提交" onclick="addNew()">
                <input type="button" value="取消" onclick="hideAdd()">
            </form>
        </div>-->
    <div class="row">
        dddd
    </div>
</div>
<script>
    $(function () {
        $("#source").hide();
    })

    function showAdd() {
        $("#source").show()
        var url = "/model/find/all";
        $.get(url, function (data) {
            //console.log(data)
            $.each(data.data, function (i, e) {

                $("#modelId").append("<option value='" + e.id + "'>" + e.modelName + "</option>")
            })

        })
        var url2 = "/source/find/type/all"
        $.get(url2, function (data) {
            $.each(data.data, function (i, e) {

                $("#sourceTypeId").append("<option value='" + e.id + "'>" + e.typeName + "</option>")
            })
        })
    }

    function hideAdd() {
        $("#source").hide();
    }

    function addNew() {
        alert("tijiao")
    }
</script>
<hr>
<div class="container-fluid">
    <div class="row" id="datas">
        <div class="col">1</div>
        <div class="col">1</div>
    </div>

</div>
</body>
</html>